<template>
	<view>
		<view class="info">
			<view class="infos">
				<view class="one">
					<view class="name">
						{{info.name}}
					</view>
					<view class="tel">
						{{info.curriculumName}}
					</view>
				</view>
				<view class="address">
					{{info.detailedAddress}}
				</view>
			</view>
		</view>
		<view class="list">
			<view class="list-item">
				<view class="item-title">
					支付状态:
				</view>
				<view class="item-text">
					{{info.payFlag=='Y'?'已支付':'未支付'}}
				</view>
			</view>
			<view class="list-item">
				<view class="item-title">
					订单金额:
				</view>
				<view class="item-text">
					{{info.costMoney}}元
				</view>
			</view>
			<view class="list-item">
				<view class="item-title">
					订单时间:
				</view>
				<view class="item-text">
					{{info.createTime}}
				</view>
			</view>
			<view class="list-item">
				<view class="item-title">
					手机号码:
				</view>
				<view class="item-text">
					{{info.phone}}
				</view>
			</view>

		</view>
		<view class="pay" @click="goexam" v-if="info.payFlag=='Y'&&!info.answerId">
			前往考试
		</view>
		<view class="pay" @click="gopays" v-if="info.payFlag=='N'">
			去支付
		</view>
		<view class="pay" @click="gohome">
			返回首页
		</view>
	</view>
</template>

<script>
	import {
		memberCurriculumdetail,
		payment
	} from "@/api/home/index.js"
	export default {
		data() {
			return {
				info: {},
				id: '',
				userinfo: {}
			}
		},
		async onLoad(val) {

			this.userinfo = uni.getStorageSync('userInfo')
			console.log(this.userinfo, '用户信息');
			console.log(val.id);
			this.id = val.id
			let res = await memberCurriculumdetail(
				val
			)
			console.log(res.data, '1111111');
			this.info = res.data
			uni.setStorageSync("paperId", res.data.paperId)
		},
		methods: {
			gohome() {
				uni.switchTab({
					url: `/pages/index/index`
				})
			},
			goexam() {
				uni.navigateTo({
					url: `/packageA/pages/exam/index?id=${this.id}`
				})
			},
			gopays(){
				uni.navigateTo({
					url: `/packageA/pages/pay/pay?id=${this.id}`
				})
			}

		}
	}
</script>

<style>
	.info {
		background-color: #034096;
		width: 100%;
		height: 200rpx;
	}

	.infos {
		background-color: #fff;
		height: 200rpx;
		width: 710rpx;
		border-radius: 30rpx;
		margin: 0 auto;
		transform: translateY(50%);
	}

	.one {
		padding: 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-weight: 700;
	}

	.address {
		padding: 0 30rpx;
	}

	.list {
		background-color: #fff;

		width: 710rpx;
		border-radius: 30rpx;
		margin: 0 auto;
		transform: translateY(120rpx);
	}

	.list-item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx 10rpx;
	}

	.pay {
		border-radius: 30rpx;
		width: 500rpx;
		transform: translateY(140rpx);
		padding: 18rpx;
		text-align: center;
		background-color: #034096;
		color: #fff;
		margin: 30rpx auto;
		font-weight: 700;
	}
</style>